<template>
  <div class="new-products">
    <div class="header">
      <h1>上新精选</h1>
      <p class="subtitle">闭眼放心买</p>
    </div>

    <div class="products-grid">
      <!-- 热敷气囊护颈枕 -->
      <div class="product-card">
        <div class="product-image pillow">枕</div>
        <div class="product-info">
          <h2>热敷气囊护颈枕</h2>
          <p class="description">3档定时热敷，气囊调节高度</p>
          <div class="rating">
            <span class="rate">97% 好评率</span>
          </div>
          <div class="tags">
            <span class="tag life">生活优选</span>
            <span class="tag up">UP会员 折上折</span>
          </div>
          <div class="price">
            <span class="amount">¥99</span>
            <span class="unit">起</span>
          </div>
        </div>
      </div>

      <!-- 燃电混动热水器 -->
      <div class="product-card">
        <div class="product-image heater">热</div>
        <div class="product-info">
          <h2>燃电混动热水器</h2>
          <p class="description">燃电混动黑科技，增压零冷水</p>
          <div class="rating">
            <span class="rate">96% 好评率</span>
          </div>
          <div class="tags">
            <span class="tag up">UP会员 折上折</span>
            <span class="tag flash">有品秒杀</span>
          </div>
          <div class="price">¥1649</div>
        </div>
      </div>

      <!-- 宠物饮水机 -->
      <div class="product-card">
        <div class="product-image pet">水</div>
        <div class="product-info">
          <h2>宠物饮水机</h2>
          <p class="description">无线长续航，畅饮健康水</p>
          <div class="tags">
            <span class="tag mi">小米自营</span>
          </div>
          <div class="price">
            <span class="amount">¥199</span>
            <span class="unit">起</span>
          </div>
        </div>
      </div>

      <!-- 现代简约功能沙发 -->
      <div class="product-card">
        <div class="product-image sofa">沙</div>
        <div class="product-info">
          <h2>现代简约功能沙发</h2>
          <p class="description">分区靠背，电动实用</p>
          <div class="price">
            <span class="amount">¥1349</span>
            <span class="unit">起</span>
            <span class="original">¥1799</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.new-products {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  margin-bottom: 30px;
}

h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-image {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.pillow {
  background: #826c5b;
}

.heater {
  background: #333;
}

.pet {
  background: #4caf50;
}

.sofa {
  background: #9c27b0;
}

.product-info {
  padding: 15px;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.description {
  color: #666;
  margin-bottom: 10px;
}

.rating {
  margin-bottom: 10px;
}

.rate {
  color: #ff6700;
}

.tags {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.tag.life {
  background: #ffe1bd;
  color: #c17b3c;
}

.tag.up {
  background: #e1f5fe;
  color: #0288d1;
}

.tag.flash {
  background: #ffe0e0;
  color: #ff4444;
}

.tag.mi {
  background: #ff6700;
  color: white;
}

.price {
  margin-top: 15px;
}

.amount {
  font-size: 24px;
  color: #ff6700;
  font-weight: bold;
}

.unit {
  font-size: 14px;
  color: #ff6700;
  margin-left: 2px;
}

.original {
  color: #999;
  text-decoration: line-through;
  margin-left: 10px;
  font-size: 14px;
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}
</style>